Optimize test suite performance#2604
Open
mroderick wants to merge 3 commits intocodebar:masterfrom
Open
Conversation
c0a195c to
7640305
Compare
Improves model spec performance by ~15% (17.0s → 14.5s) The default :chapter fabricator was creating an organiser member with role for every chapter, but most tests don't need this. Removed the after_create callback from the default fabricator and added a new :chapter_with_organiser fabricator for tests that need it. Includes test fixes for tests broken by this change: - chapters_spec.rb: Use :chapter_with_organiser for organiser editing test - chapters_spec.rb: Use :chapter instead of :chapter_with_groups for tooltip test - managing_organisers_spec.rb: Use :chapter_with_organiser - workshops_spec.rb: Add organiser inline for Labels test
Improves model spec performance by additional ~2% (14.5s → 14.1s) Combined with chapter optimization: 17.0s → 14.1s (~17% total improvement) The default :event fabricator was creating a sponsorship for every event, but most tests don't need this. Removed the after_build callback from the default fabricator and added :event_with_sponsorship for tests that need it. Includes test fixes for tests broken by this change: - event_spec.rb: Use :chapter instead of :chapter_with_groups - manage_event_spec.rb: Use :chapter instead of :chapter_with_groups - filtering_sponsors_list_spec.rb: Use :sponsor instead of :sponsor_with_contacts - sponsor_spec.rb: Use :sponsor instead of :sponsor_with_contacts
Improves model spec performance by additional ~2% (14.1s → 13.8s) Combined optimizations: 17.0s → 13.8s (~19% total improvement) The students and coaches fabricators were creating 5 members each, but tests only need 2 members per group. Reduced member count to reduce object creation overhead. Includes test fix for meeting_spec.rb banned members test: - Updated to work with 4 total members (2 students + 2 coaches) instead of 10
7640305 to
571e718
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR optimizes the test suite performance by reducing unnecessary object creation in fabricators.
Note: This PR is built on top of #2605 which fixes workshop capacity checks. Please review/merge that PR first.
Changes
Commit 1: Optimize chapter fabricator
:chapter:chapter_with_organiserfor tests that need organisersCommit 2: Optimize event fabricator
:event:event_with_sponsorshipfor tests that need sponsorshipsCommit 3: Optimize group fabricator
:studentsand:coachesResults
Testing
Clean Commit History
Each commit is atomic and includes related test fixes: